export default {
  bind(el) {
    function documentHandler(e) {
      if (el.contains(e.target)) {
        return false;
      }
      return true;
    }
    el.click_outside = documentHandler;
    document.addEventListener('click', documentHandler);
  },
  unbind(el) {
    document.removeEventListener('click', el.click_outside);
    delete el.click_outside;
  },
};
